package com.zx._12_算法.剑指offer._2022;

/**
 * https://leetcode.cn/problems/zai-pai-xu-shu-zu-zhong-cha-zhao-shu-zi-lcof/
 */
public class 在排序数组中查找数字 {

    public int search(int[] nums, int target) {
        int count = 0;
        for (int num : nums) {
            if (target == num) {
                count++;
            } else if (count != 0) {
                break;
            }
        }
        return count;
    }
}
